package cn.kgc.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

@Component

public   class MailService {
    @Autowired
    private   JavaMailSender mailSender;
    /*发送简单邮件 to收信人,SUBJECT 标题 context 内容*/
   /* @GetMapping("/sendMail/{to}/{subject}/{context}")*/
    public    void sendSimpleMail(/*@PathVariable(value = "to")*/ String to,
                               /* @PathVariable(value = "subject")*/ String subject,
                               /* @PathVariable(value = "context")*/ String context){
        SimpleMailMessage message=new SimpleMailMessage();
        message.setSubject(subject);
        message.setTo(to);
        message.setFrom("feip.smtp@qq.com");
        message.setText(context);
        mailSender.send(message);

    }

}
